export class ArrayQueue<T> {
  arr: Array<T> = new Array<T>(1);
  constructor(maxSize: number) {
    this.arr = new Array<T>(maxSize);
  }

  push(e: T) {
    this.arr.push(e);
  }

  //出队操作
  pop(): T {
    return this.arr.splice(0, 1)[0];
  }
  getFront(): T {
    return this.arr[0];
  }

  getRear(): T {
    return this.arr[this.arr.length - 1];
  }
  //clear queue
  clear() {
    this.arr = [];
  }
  //get queue length
  size(): number {
    return this.arr.length;
  }
}
